{% if launchurl %}
  <p>
  <button onClick="window.location='{{ context.getGetPath }}'; return false;">
    New Launch
  </button>
  </p>
  {% if newwindow %}
    <script language="JavaScript">
      window.open('{{launchurl}}')
    </script>
    <p>Content has been opened in a new window.</p>
  {% else %}
    <iframe width="100%" frameborder="0" marginwidth="0"
            marginheight="0" scrolling="auto"
            src="{{launchurl}}"
            height="{{height}}">
      Your browser does not support iframes. <br>
      <a href="{{launchurl}}" target="_new">Press here for content</a>
    </iframe>
  {% endif %}
{% else %}
  <p>This is a Simple LTI Launcher.  You can enter a URL and a secret.</p>
  {% if msg %}
    <p>{{ msg }}</p>
  {% endif %}
  <form method="post" action="{{ context.getPostPath }}">
  {{ context.getFormFields }}
  <p>
  Enter URL: <input type="text" name="url" size="60" value="http://simplelti.appspot.com/launch"/><br>
  Enter secret: <input type="password" name="secret" value="secret"/><br>
  Enter frame height: <input type="text" name="height"/><br>
  Enter Tool ID (optional): <input type="text" name="tool_id"/><br>
  <input type="checkbox" name="newwindow" value="yes" checked> Open in new window<br>
  <p><input type="submit"></p>
  </form>
<p>Here are a few places you might want to launch to:</p>
<ul>
<li>http://simplelti.appspot.com/launch/</li>
<li>http://wiscrowd.appspot.com/wiscrowd/</li>
<li>http://www.cloudsocial.org/dev/index.php?cs_course=cloud123&cs_forward=http://www.appenginelearn.com/</li>
<li>http://www.cloudsocial.org/dev/index.php?cs_course=cloud123&cs_forward=http://www.pythonlearn.com/</li>
<li>http://www.cloudsocial.org/dev/index.php?cs_course=cloud123&cs_forward=http://www.cloudsocial.org/sample.htm</li>
</ul>
<p>Make sure to get the whole line for the cloudsocial launches.</p>
<pre>
{{ data }}
</pre>
{% endif %}
<hr>
<h2>CloudSocial Hacking Guide</h2>
<p>
If you want to hack CloudSocial on your own page, add the following
Javascript at the end of your web documents.  It does not matter
if the documents come from a content system, LMS, or just flat HTML
on your desktop.
<pre>
&lt;script type="text/javascript"
  src="http://www.cloudsocial.org/code/ile-main.js"&gt;
&lt;/script&gt;
&lt;script type="text/javascript"&gt;
  ile_init("ILE_APP_KEY");
&lt;/script&gt;
</pre>
Then launch to to your site through CloudSocial changing the cs_launch
parameters above.  Your page will consult with CloudSocial and
notice that you are logged in and bring up the LMS.   Folks who don't log
in will not see anything different on your site.
<p>
You can also launch to the "sample.htm" above and view source.
<p>
Agin the fun bit is to get logged in and then navigate between pages
with your litte LMS tagging along.   You could put the Javascript in the footer
of a site and the little LMS will be present on every page.
<p>
Someday soon - we will have CloudSocial really up so you can create and
configure your own courses.  <b>Please don't put this Javascript in
lots of production pages unless it is easily changed.  We will end up with
real application keys and may even change the Javascript syntax as 
part of our evolutionary learning.</b>
</p>

